package com.qyer.search.storm.util;

import java.io.Serializable;
import java.util.List;

/**
 * Created by tangzheng on 16/1/10.
 */
public class EntityTags implements Serializable {
  private int lid;
  private List<Tag> tags;

  public EntityTags() {
  }

  public EntityTags(int lid, List<Tag> tags){
    this.lid = lid;
    this.tags = tags;
  }

  public List<Tag> getTags() {
    return tags;
  }

  public void setTags(List<Tag> tags) {
    this.tags = tags;
  }

  public int getLid() {
    return lid;
  }

  public void setLid(int lid) {
    this.lid = lid;
  }

  public void addTags(Tag tag){
    this.tags.add(tag);
  }

  @Override public String toString() {
    return "EntityTags{" +
      "lid=" + lid +
      ", tags=" + tags +
      '}';
  }

  @Override public boolean equals(Object o) {
    if (this == o)
      return true;
    if (o == null || getClass() != o.getClass())
      return false;

    EntityTags that = (EntityTags) o;

    if (lid != that.lid)
      return false;
    return tags.equals(that.tags);

  }

  @Override public int hashCode() {
    int result = lid;
    result = 31 * result + tags.hashCode();
    return result;
  }
}
